package com.home766.dao.impl;

import com.home766.dao.CustomerServiceDao;
import com.home766.entity.CustomerService;
import com.home766.util.StringUtil;
import net.biz.Page;
import net.biz.Pageable;
import net.biz.dao.NativeBaseDao;
import net.biz.dao.impl.BaseDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

/***
 * 
 * @author devin.zeng
 *
 */
@Repository("customerServiceDaoImpl")
public class CustomerServiceDaoImpl extends BaseDaoImpl<CustomerService,Long> implements CustomerServiceDao{
	@Autowired
	private NativeBaseDao nativeBaseDao;

	@Override
	public Page<CustomerService> findList(CustomerService customerService,
                                          Pageable pageable, String properties) {
		// TODO Auto-generated method stub
		String sql=" select cs.id as id, cs.c_name as c_Name,cs.phone as phone,cs.address as address,cs.content as content,cs.create_date as create_Date,cs.handle as handle"
				+ " ,cs.handle_people as handle_People from 766_customer_service cs";
		Map<String,Object> tempMap = new HashMap<String, Object>();
		if(StringUtil.isNotEmpty(properties)){
			sql+=" order by "+properties;
		}else{
			sql+=" order by cs.create_date desc";
		}
		return nativeBaseDao.findPage(sql, tempMap, pageable, CustomerService.class);
	}
}
